package com.hl.qzzpbackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 审核状态枚举
 * @author helong
 */
@Getter
public enum CheckStatusEnum {

    NOT_REVIEWED(0, "未审核"),
    PASS(1, "审核通过"),
    NO_PASS(2, "审核不通过");



    private final Integer value;
    private final String text;

    // 构造函数
    CheckStatusEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static CheckStatusEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (CheckStatusEnum checkStatusEnum : CheckStatusEnum.values()) {
            if (checkStatusEnum.getValue().equals(value)) {
                return checkStatusEnum;
            }
        }
        return null;
    }
}
